//
//  NETabBarViewController.m
//  NetEasyNews
//
//  Created by weiwang on 16/7/18.
//  Copyright © 2016年 王伟. All rights reserved.
//

#import "NETabBarViewController.h"
#import "NEADViewController.h"
#import "UIView+Extension.h"

@interface NETabBarViewController ()

@end

@implementation NETabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self _setADViewController];
    
    UIViewController *c1=[[UIViewController alloc]init];
    UINavigationController *nv = [[UINavigationController alloc] initWithRootViewController:c1];
    
    UIViewController *c2=[[UIViewController alloc]init];
    UINavigationController *nv2 = [[UINavigationController alloc] initWithRootViewController:c2];

    UIViewController *c3=[[UIViewController alloc]init];
    UINavigationController *nv3 = [[UINavigationController alloc] initWithRootViewController:c3];
    
    UIViewController *c4=[[UIViewController alloc]init];
    UINavigationController *nv4 = [[UINavigationController alloc] initWithRootViewController:c4];

    self.viewControllers = @[nv, nv2, nv3, nv4];
    
    self.tabBar.tintColor = [UIColor redColor];
    NSArray *titles = @[@"新闻", @"视频", @"话题", @"我"];
    NSArray *images = @[@"tabbar_icon_news", @"tabbar_icon_media", @"tabbar_icon_bar", @"tabbar_icon_me"];
    [self.tabBar.items enumerateObjectsUsingBlock:^(UITabBarItem *item, NSUInteger idx, BOOL *stop) {
        [item setTitle:titles[idx]];
        [item setImage:[UIImage imageNamed:images[idx]]];
        [item setSelectedImage:[[UIImage imageNamed:[images[idx] stringByAppendingString:@"_highlight"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    }];
}
-(void)func
{
    
}

#pragma mark- private function
//设置首页启动广告
-(void)_setADViewController
{
    NEADViewController *advc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"ADVC"];
    
    advc.view.frame = self.view.bounds;
    [self addChildViewController:advc];
    [self.view addSubview:advc.view];
}

@end
